package com.hongye.house.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hongye.common.utils.PageUtils;
import com.hongye.common.utils.Query;

import com.hongye.house.dao.NewsHomeDao;
import com.hongye.house.entity.NewsHomeEntity;
import com.hongye.house.service.NewsHomeService;


@Service("newsHomeService")
public class NewsHomeServiceImpl extends ServiceImpl<NewsHomeDao, NewsHomeEntity> implements NewsHomeService {

    @Autowired(required = false)
    private NewsHomeDao newsHomeDao;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<NewsHomeEntity> page = this.page(
                new Query<NewsHomeEntity>().getPage(params),
                new QueryWrapper<NewsHomeEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public List<NewsHomeEntity> hotlist() {

        return this.baseMapper.selectList(new QueryWrapper<NewsHomeEntity>().orderByAsc("news_sort"));
    }

    @Override
    public List<NewsHomeEntity> findByphone(String newsTitle) {
        return newsHomeDao.findByphone(newsTitle);
    }

}